<?php
  require_once 'DB.php';
  include_once("./libraries/db.inc.php");
  include_once("./libraries/authentication.inc.php");
  include_once("./queries/usagereport.inc.php");
  include_once("./libraries/util.inc.php");
  include_once("./libraries/displayUtils.inc.php");
  include_once("./libraries/recordset.inc.php");

  set_time_limit(0);
  session_start();
  sessionAuthenticate("login.php");

  $dataIndex = "usagereport";
  
  $refresh = false;
  $queryType = -1;
  $params = array();
  $status = array();
  $displayPage = 1;
  unset($owner);

  //process the get variables
  foreach ($_GET as $varName => $value) {
        if ($varName == "dP") {
           $displayPage = $value;
        } 
  }

  //we need to get the data
  $connection = DB::connect($dsn, $options);
  if (DB::isError($connection)) {
    trigger_error($connection->getMessage(), E_USER_ERROR);
  }

  $rs = usageReport($connection, $dataIndex, $displayPage);
 //echo "called it";

  $connection->disconnect();
 
  $rs->printNavigablePage($_SESSION["{$dataIndex}"]["title"],
                          $_SESSION["{$dataIndex}"]["message"],
                          $displayPage,
                          "./usagereport.php");

  cdbFinishPage();
?>
